// @Author: Duanxj
// @Description:
// @Version: 1.0.0
// @Date: 2021/4/7
// @Time: 15:24

package model

import (
	"fmt"
	"github.com/gomodule/redigo/redis"
	"log"
)

func SaveImageCode(code, uuid string) error {
	// 1.链接数据库
	conn, err := redis.Dial("tcp", "127.0.0.1:6379")
	if err != nil {
		log.Println(err)
		return err
	}
	defer conn.Close()
	// 2.操作数据库
	str, err := redis.String(conn.Do("setex", uuid, 60*5, code))
	fmt.Println(str)
	return err
}
